package com.pactera.asmp.server.common.constants;

/**
 * @ProjectName: tlsserver
 * @Package com.pactera.asmp.server.common.constants
 * @ClassName: DeviceEnum
 * @Description: 设备类型
 * @Date 2020/06/02 6:26
 * @Author lvzhiqiang
 * @Version 1.0
 */
public enum DeviceEnum {

    UNKNOW_DEVICE(-1, "未知设备"),
    IVI_DEVICE_APP(0, "车机设备应用"),
    ANDROID_PHONE_APP(1, "Android手机应用"),
    ANDROID_PAD_APP(2, "Android PAD 应用"),
    MAC_PHONE_APP(3, "MAC手机应用"),
    MAC_PAD_APP(4, "MAC平板应用"),
    PC_BROWSER(5, "电脑浏览器应用"),
    TRAFFIC_LIGHT(6, "红绿灯设备应用"),
    MASTER_COMPUTER_DEVICE(7, "上位机设备");

    private int channelId;
    private String name;


    DeviceEnum(int channelId, String name) {
        this.channelId = channelId;
        this.name = name;
    }

    public static DeviceEnum value(int channelId) {

        DeviceEnum result;
        if(IVI_DEVICE_APP.channelId == channelId){
            result = IVI_DEVICE_APP;
        }else if(ANDROID_PHONE_APP.channelId == channelId){
            result = ANDROID_PHONE_APP;
        }else if(ANDROID_PAD_APP.channelId == channelId){
            result = ANDROID_PAD_APP;
        }else if(MAC_PHONE_APP.channelId == channelId){
            result = MAC_PHONE_APP;
        }else if(MAC_PAD_APP.channelId == channelId){
            result = MAC_PAD_APP;
        }else if(PC_BROWSER.channelId == channelId){
            result = PC_BROWSER;
        }else if(TRAFFIC_LIGHT.channelId == channelId){
            result = TRAFFIC_LIGHT;
        }else{
            result = UNKNOW_DEVICE;
        }
        return result;
    }

    public int getChannelId() {
        return channelId;
    }

    public void setChannelId(int channelId) {
        this.channelId = channelId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
